package cn.eclass.bean;

import cn.eclass.bean.api.ISchoolOrderBean;
import cn.eclass.dao.SchoolOrderDao;
import cn.eclass.entity.SchoolOrderEntity;
import java.util.List;

public class SchoolOrderBean implements ISchoolOrderBean {

    SchoolOrderDao dao = new SchoolOrderDao();

    @Override
    public List<SchoolOrderEntity> getByUser(int userId) {
    	return dao.getByUser(userId);
    }
    
    @Override
    public boolean approveOrder(SchoolOrderEntity order) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public List<SchoolOrderEntity> getRecentOrders(int amount) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public SchoolOrderEntity add(SchoolOrderEntity entity) {
        int newId = dao.add(entity);
        if(newId > 0) {
        	entity.setId(newId);
        	return entity;
        }
        return null;
    }

    @Override
    public boolean update(SchoolOrderEntity entity) {
        return dao.update(entity);
    }

    @Override
    public boolean delete(int id) {
        return dao.delete(id);
    }

    @Override
    public SchoolOrderEntity get(int id) {
        return dao.get(id);
    }

    @Override
    public List<SchoolOrderEntity> list() {
        return dao.list();
    }

	@Override
	public int getOrderCountBySchoolId(int id) {
		// TODO Auto-generated method stub
		return 0;
	}
}
